<?php

namespace app\api\controller;

use app\common\controller\BasicApi;
use app\common\model\BannerModel;
use app\common\model\NoticeModel;
use app\common\model\SchoolClassModel;
use app\common\model\SchoolGradeModel;
use app\common\model\SchoolModel;

class School extends BasicApi
{

   /**
    * 获取学校列表
    */
   public function getSchool(){
       $school = SchoolModel::where('status',1)->order('sort asc,id desc')->select();
       if (!empty($school)) {
           $this->success('获取学校列表成功！', $school, 200);
       } else {
           $this->error('获取学校列表失败！', '', 400);
       }
   }

    /**
     * 获取年级列表
     */
    public function getGrade(){
        $grade = SchoolGradeModel::where('status',1)->order('sort asc,id desc')->select();
        if (!empty($grade)) {
            $this->success('获取年级列表成功！', $grade, 200);
        } else {
            $this->error('获取年级列表失败！', '', 400);
        }
    }

    /**
     * 获取班级列表
     */
    public function getClass(){
        $class = SchoolClassModel::where('status',1)->order('sort asc,id desc')->select();
        if (!empty($class)) {
            $this->success('获取班级列表成功！', $class, 200);
        } else {
            $this->error('获取班级列表失败！', '', 400);
        }
    }

}
